Input and Output Functions

The input and output functions of KCL almost follow the definitions in Chapter 22 of the Common Lisp Reference Manual . Most of the differences come from the fact that, in KCL, input from the terminal is always in line mode and binary I/O is not supported.


In KCL, *terminal-io* is a two-way stream from the standard input and to the standard output. The echoing to the terminal is performed by the underlying operating system. In particular, when a disk file is assigned to the standard output, nothing will be echoed at the terminal.


Those functions that deviate from the definitions in the Common Lisp Reference Manual are listed below.



load pathname &key :print :verbose :if-does-not-exist[Function]

If pathname does not specify the filetype of the input file, then load first tries to load a file with the filetype .o , i.e., the fasl file (see Chapter 6). If it fails, then load tries to load a file with the filetype .lsp. KCL assumes that .lsp is the standard filetype for source files. If it fails again, then load will load the specified file with no filetype.

load recognizes a file as a fasl file if and only if the filetype of the file is .o . Other files are assumed to be source files.



———— Note to KCL/AOS users ————-



In KCL/AOS, the filetype of fasl files is .fasl (see Chapter 6). Therefore, if the pathname argument does not explicitly specify the filetype, load first tries to load a file with the filetype .fasl . In addition, load recognizes a file as a fasl file if and only if the filetype of the file is .fasl .



—————- End of Note —————–



open[Function ]

The argument to the keyword variable :element-type and :element-type is always bound to the value string-char .

close[Function]

The keyword variable :abort is always ignored.

listen[Function]

listen always returns t .

read-char-no-hang[Function]

read-char-no-hang is equivalent to read-char

clear-input[Function]
clear-output[Function]

clear-input and clear-output simply return nil without doing anything.

read-byte[Function]
write-byte[Function]

These functions may operate on any stream. They read or write a byte (8 bits) at a time.

princ[Function]
write-char[Function]
write-byte[Function]

These functions do not always flush the stream. The stream is flushed when
1.
a newline character is written, or

2.
the input from the terminal is requested in the case that these functions operate on *terminal-io*